package com.zbu.friend.controller.user;

import com.fasterxml.jackson.databind.ser.Serializers;
import com.zbu.common.core.comtroller.BaseController;
import com.zbu.common.core.constants.HttpConstants;
import com.zbu.common.core.domain.R;
import com.zbu.common.core.domain.TableDataInfo;
import com.zbu.friend.domain.exam.dto.ExamDTO;
import com.zbu.friend.domain.exam.dto.ExamQueryDTO;
import com.zbu.friend.service.user.IUserExamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/user/exam")
public class UserExamController extends BaseController {
    @Autowired
    private IUserExamService userExamService;
    @PostMapping("/enter")
    public R<Void> enter(@RequestHeader(HttpConstants.AUTHENTICATION) String token, @RequestBody ExamDTO examDTO){
            return toR(userExamService.enter(token,examDTO.getExamId()));
    }
    @GetMapping("/list")
    public TableDataInfo list(ExamQueryDTO examQueryDTO){
        return userExamService.list(examQueryDTO);
    }
}
